﻿<%@ Page Title="IRS交易資料" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="IRSTrade.aspx.cs" Inherits="IRSTrade"%>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <p>
        &nbsp;資料日期：<asp:TextBox ID="reportDate" runat="server"></asp:TextBox>
    &nbsp;
        <asp:Button ID="queryBtn" runat="server" Text="取得交易資料" 
            onclick="queryBtn_Click" />
    &nbsp;<asp:Button ID="exportToCsv" runat="server" onclick="exportToCsv_Click" 
            Text="匯出到CSV" />
    </p>
    <p>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSource1" DataKeyNames="id" CellPadding="4" 
            ForeColor="#333333" GridLines="None">
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <Columns>
                <asp:BoundField DataField="ProductType" HeaderText="ProductType" 
                    SortExpression="ProductType" />
                <asp:BoundField DataField="SequenceNo" HeaderText="SequenceNo" 
                    SortExpression="SequenceNo" />
                <asp:BoundField DataField="BankCode" HeaderText="BankCode" 
                    SortExpression="BankCode" />
                <asp:BoundField DataField="BankType" HeaderText="BankType" 
                    SortExpression="BankType" />
                <asp:BoundField DataField="TransUnit" HeaderText="TransUnit" 
                    SortExpression="TransUnit" />
                <asp:BoundField DataField="CptyType" HeaderText="CptyType" 
                    SortExpression="CptyType" />
                <asp:BoundField DataField="CptyName" HeaderText="CptyName" 
                    SortExpression="CptyName" />
                <asp:BoundField DataField="CptyCode" HeaderText="CptyCode" 
                    SortExpression="CptyCode" />
                <asp:BoundField DataField="TransReason" HeaderText="TransReason" 
                    SortExpression="TransReason" />
                <asp:BoundField DataField="TradeDate" HeaderText="TradeDate" 
                    SortExpression="TradeDate" DataFormatString="{0:d}" />
                <asp:BoundField DataField="EffectiveDate" HeaderText="EffectiveDate" 
                    SortExpression="EffectiveDate" DataFormatString="{0:d}" />
                <asp:BoundField DataField="MaturityDate" HeaderText="MaturityDate" 
                    SortExpression="MaturityDate" DataFormatString="{0:d}" />
                <asp:BoundField DataField="FirstPayRecCcy" HeaderText="FirstPayRecCcy" 
                    SortExpression="FirstPayRecCcy" />
                <asp:BoundField DataField="FirstPayRecAmt" HeaderText="FirstPayRecAmt" 
                    SortExpression="FirstPayRecAmt" />
                <asp:BoundField DataField="NotionalCcy" HeaderText="NotionalCcy" 
                    SortExpression="NotionalCcy" />
                <asp:BoundField DataField="NotionalAmt" HeaderText="NotionalAmt" 
                    SortExpression="NotionalAmt" />
                <asp:BoundField DataField="IndexType" HeaderText="IndexType" 
                    SortExpression="IndexType" />
                <asp:BoundField DataField="RollDateType" HeaderText="RollDateType" 
                    SortExpression="RollDateType" />
                <asp:BoundField DataField="isCompounding" HeaderText="isCompounding" 
                    SortExpression="isCompounding" />
                <asp:BoundField DataField="RateSettleType" HeaderText="RateSettleType" 
                    SortExpression="RateSettleType" />
                <asp:BoundField DataField="FixRate" HeaderText="FixRate" 
                    SortExpression="FixRate" />
                <asp:BoundField DataField="FixPaySchedule" HeaderText="FixPaySchedule" 
                    SortExpression="FixPaySchedule" />
                <asp:BoundField DataField="FixBasis" HeaderText="FixBasis" 
                    SortExpression="FixBasis" />
                <asp:BoundField DataField="FloatIndex" HeaderText="FloatIndex" 
                    SortExpression="FloatIndex" />
                <asp:BoundField DataField="FloatIntTermType" HeaderText="FloatIntTermType" 
                    SortExpression="FloatIntTermType" />
                <asp:BoundField DataField="FloatTerm" HeaderText="FloatTerm" 
                    SortExpression="FloatTerm" />
                <asp:BoundField DataField="FloatResetType" HeaderText="FloatResetType" 
                    SortExpression="FloatResetType" />
                <asp:BoundField DataField="FloatSpread" HeaderText="FloatSpread" 
                    SortExpression="FloatSpread" />
                <asp:BoundField DataField="FloatBasis" HeaderText="FloatBasis" 
                    SortExpression="FloatBasis" />
                <asp:BoundField DataField="Float1Index" HeaderText="Float1Index" 
                    SortExpression="Float1Index" />
                <asp:BoundField DataField="Float1IntTermType" HeaderText="Float1IntTermType" 
                    SortExpression="Float1IntTermType" />
                <asp:BoundField DataField="Float1Term" HeaderText="Float1Term" 
                    SortExpression="Float1Term" />
                <asp:BoundField DataField="Float1ResetType" HeaderText="Float1ResetType" 
                    SortExpression="Float1ResetType" />
                <asp:BoundField DataField="Float1Spread" HeaderText="Float1Spread" 
                    SortExpression="Float1Spread" />
                <asp:BoundField DataField="Float1Basis" HeaderText="Float1Basis" 
                    SortExpression="Float1Basis" />
            </Columns>
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <EmptyDataTemplate>
                執行結果： 
                <br />
                <span class="style4">您輸入的資料日期，目前查無符合資料！</span>
            </EmptyDataTemplate>
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#999999" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:FEIBConnectionString %>" 
            DeleteCommand="DELETE FROM [TR_FormatA_IRS] WHERE [id] = @id" 
            InsertCommand="INSERT INTO [TR_FormatA_IRS] ([ProductType], [SequenceNo], [BankCode], [BankType], [TransUnit], [CptyType], [CptyName], [CptyCode], [TransReason], [TradeDate], [EffectiveDate], [MaturityDate], [FirstPayRecCcy], [FirstPayRecAmt], [NotionalCcy], [NotionalAmt], [IndexType], [RollDateType], [isCompounding], [RateSettleType], [FixRate], [FixPaySchedule], [FixBasis], [FloatIndex], [FloatIntTermType], [FloatTerm], [FloatResetType], [FloatSpread], [FloatBasis], [Float1Index], [Float1IntTermType], [Float1Term], [Float1ResetType], [Float1Spread], [Float1Basis], [TradeType]) VALUES (@ProductType, @SequenceNo, @BankCode, @BankType, @TransUnit, @CptyType, @CptyName, @CptyCode, @TransReason, @TradeDate, @EffectiveDate, @MaturityDate, @FirstPayRecCcy, @FirstPayRecAmt, @NotionalCcy, @NotionalAmt, @IndexType, @RollDateType, @isCompounding, @RateSettleType, @FixRate, @FixPaySchedule, @FixBasis, @FloatIndex, @FloatIntTermType, @FloatTerm, @FloatResetType, @FloatSpread, @FloatBasis, @Float1Index, @Float1IntTermType, @Float1Term, @Float1ResetType, @Float1Spread, @Float1Basis, @TradeType)" 
            SelectCommand="SELECT * FROM [TR_FormatA_IRS] WHERE (([TradeType] = @TradeType) AND ([TradeDate] = @TradeDate))" 
            
            UpdateCommand="UPDATE [TR_FormatA_IRS] SET [ProductType] = @ProductType, [SequenceNo] = @SequenceNo, [BankCode] = @BankCode, [BankType] = @BankType, [TransUnit] = @TransUnit, [CptyType] = @CptyType, [CptyName] = @CptyName, [CptyCode] = @CptyCode, [TransReason] = @TransReason, [TradeDate] = @TradeDate, [EffectiveDate] = @EffectiveDate, [MaturityDate] = @MaturityDate, [FirstPayRecCcy] = @FirstPayRecCcy, [FirstPayRecAmt] = @FirstPayRecAmt, [NotionalCcy] = @NotionalCcy, [NotionalAmt] = @NotionalAmt, [IndexType] = @IndexType, [RollDateType] = @RollDateType, [isCompounding] = @isCompounding, [RateSettleType] = @RateSettleType, [FixRate] = @FixRate, [FixPaySchedule] = @FixPaySchedule, [FixBasis] = @FixBasis, [FloatIndex] = @FloatIndex, [FloatIntTermType] = @FloatIntTermType, [FloatTerm] = @FloatTerm, [FloatResetType] = @FloatResetType, [FloatSpread] = @FloatSpread, [FloatBasis] = @FloatBasis, [Float1Index] = @Float1Index, [Float1IntTermType] = @Float1IntTermType, [Float1Term] = @Float1Term, [Float1ResetType] = @Float1ResetType, [Float1Spread] = @Float1Spread, [Float1Basis] = @Float1Basis, [TradeType] = @TradeType WHERE [id] = @id">
            <SelectParameters>
                <asp:Parameter DefaultValue="IRS" Name="TradeType" Type="String" />
                <asp:ControlParameter ControlID="reportDate" Name="TradeDate" 
                    PropertyName="Text" Type="DateTime" />
            </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="id" Type="Int64" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="ProductType" Type="String" />
                <asp:Parameter Name="SequenceNo" Type="String" />
                <asp:Parameter Name="BankCode" Type="String" />
                <asp:Parameter Name="BankType" Type="String" />
                <asp:Parameter Name="TransUnit" Type="String" />
                <asp:Parameter Name="CptyType" Type="String" />
                <asp:Parameter Name="CptyName" Type="String" />
                <asp:Parameter Name="CptyCode" Type="String" />
                <asp:Parameter Name="TransReason" Type="String" />
                <asp:Parameter Name="TradeDate" Type="DateTime" />
                <asp:Parameter Name="EffectiveDate" Type="DateTime" />
                <asp:Parameter Name="MaturityDate" Type="DateTime" />
                <asp:Parameter Name="FirstPayRecCcy" Type="String" />
                <asp:Parameter Name="FirstPayRecAmt" Type="Decimal" />
                <asp:Parameter Name="NotionalCcy" Type="String" />
                <asp:Parameter Name="NotionalAmt" Type="Decimal" />
                <asp:Parameter Name="IndexType" Type="String" />
                <asp:Parameter Name="RollDateType" Type="String" />
                <asp:Parameter Name="isCompounding" Type="String" />
                <asp:Parameter Name="RateSettleType" Type="String" />
                <asp:Parameter Name="FixRate" Type="Decimal" />
                <asp:Parameter Name="FixPaySchedule" Type="String" />
                <asp:Parameter Name="FixBasis" Type="String" />
                <asp:Parameter Name="FloatIndex" Type="String" />
                <asp:Parameter Name="FloatIntTermType" Type="String" />
                <asp:Parameter Name="FloatTerm" Type="String" />
                <asp:Parameter Name="FloatResetType" Type="String" />
                <asp:Parameter Name="FloatSpread" Type="Decimal" />
                <asp:Parameter Name="FloatBasis" Type="String" />
                <asp:Parameter Name="Float1Index" Type="String" />
                <asp:Parameter Name="Float1IntTermType" Type="String" />
                <asp:Parameter Name="Float1Term" Type="String" />
                <asp:Parameter Name="Float1ResetType" Type="String" />
                <asp:Parameter Name="Float1Spread" Type="Decimal" />
                <asp:Parameter Name="Float1Basis" Type="String" />
                <asp:Parameter Name="TradeType" Type="String" />
                <asp:Parameter Name="id" Type="Int64" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="ProductType" Type="String" />
                <asp:Parameter Name="SequenceNo" Type="String" />
                <asp:Parameter Name="BankCode" Type="String" />
                <asp:Parameter Name="BankType" Type="String" />
                <asp:Parameter Name="TransUnit" Type="String" />
                <asp:Parameter Name="CptyType" Type="String" />
                <asp:Parameter Name="CptyName" Type="String" />
                <asp:Parameter Name="CptyCode" Type="String" />
                <asp:Parameter Name="TransReason" Type="String" />
                <asp:Parameter Name="TradeDate" Type="DateTime" />
                <asp:Parameter Name="EffectiveDate" Type="DateTime" />
                <asp:Parameter Name="MaturityDate" Type="DateTime" />
                <asp:Parameter Name="FirstPayRecCcy" Type="String" />
                <asp:Parameter Name="FirstPayRecAmt" Type="Decimal" />
                <asp:Parameter Name="NotionalCcy" Type="String" />
                <asp:Parameter Name="NotionalAmt" Type="Decimal" />
                <asp:Parameter Name="IndexType" Type="String" />
                <asp:Parameter Name="RollDateType" Type="String" />
                <asp:Parameter Name="isCompounding" Type="String" />
                <asp:Parameter Name="RateSettleType" Type="String" />
                <asp:Parameter Name="FixRate" Type="Decimal" />
                <asp:Parameter Name="FixPaySchedule" Type="String" />
                <asp:Parameter Name="FixBasis" Type="String" />
                <asp:Parameter Name="FloatIndex" Type="String" />
                <asp:Parameter Name="FloatIntTermType" Type="String" />
                <asp:Parameter Name="FloatTerm" Type="String" />
                <asp:Parameter Name="FloatResetType" Type="String" />
                <asp:Parameter Name="FloatSpread" Type="Decimal" />
                <asp:Parameter Name="FloatBasis" Type="String" />
                <asp:Parameter Name="Float1Index" Type="String" />
                <asp:Parameter Name="Float1IntTermType" Type="String" />
                <asp:Parameter Name="Float1Term" Type="String" />
                <asp:Parameter Name="Float1ResetType" Type="String" />
                <asp:Parameter Name="Float1Spread" Type="Decimal" />
                <asp:Parameter Name="Float1Basis" Type="String" />
                <asp:Parameter Name="TradeType" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>
&nbsp;<asp:CalendarExtender ID="reportDate_CalendarExtender" runat="server" 
            Enabled="True" Format="yyyy/MM/dd" TargetControlID="reportDate">
        </asp:CalendarExtender>
    </p>
</asp:Content>

